package com.zufangbao.earth.entity.particalsystem;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.springframework.util.StringUtils;

import com.zufangbao.gluon.api.quark.ParticalStatus;
import com.zufangbao.gluon.api.quark.ParticalType;
import com.zufangbao.gluon.opensdk.Md5Util;

@Entity
@Table(name = "partical")
public class Partical {
	
	@Id
	@GeneratedValue
	private Long id;
	
	private String particalName;
	
	@Enumerated(EnumType.ORDINAL)
	private ParticalType particalType;
	
	@Enumerated(EnumType.ORDINAL)
	private ParticalStatus particalStatus;
	
	private String entryUrl;
	
	private String uniqueParticalId;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getParticalName() {
		return particalName;
	}

	public void setParticalName(String particalName) {
		this.particalName = particalName;
	}

	public ParticalType getParticalType() {
		return particalType;
	}

	public void setParticalType(ParticalType particalType) {
		this.particalType = particalType;
	}

	public ParticalStatus getParticalStatus() {
		return particalStatus;
	}

	public void setParticalStatus(ParticalStatus particalStatus) {
		this.particalStatus = particalStatus;
	}

	public String getEntryUrl() {
		return entryUrl;
	}

	public void setEntryUrl(String entryUrl) {
		this.entryUrl = entryUrl;
		this.uniqueParticalId = Md5Util.encode(entryUrl);
	}
	
	public String getUniqueParticalId() {
		return uniqueParticalId;
	}

	public void setUniqueParticalId(String uniqueParticalId) {
		this.uniqueParticalId = uniqueParticalId;
	}

	public boolean isNotValid() {
		return StringUtils.isEmpty(getEntryUrl()) 
													|| StringUtils.isEmpty(getParticalName())
													|| StringUtils.isEmpty(getParticalStatus())
													|| StringUtils.isEmpty(getParticalType());
	}
	
	
	
	
	
	

}
